#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    setWindowTitle("miniPotPlay v1.0");

}

Widget::~Widget()
{
    delete ui;
}

//播放or暂停
void Widget::on_playbtn_clicked()
{
    //切换图标
    QIcon playIcon(":/image/images/play.png");
    QIcon pauseIcon(":/image/images/pause.png");
    playbtnbool = !playbtnbool;
    if(this->playbtnbool == true)
    {
        ui->playbtn->setIcon(playIcon);
    }
    else
    {
        ui->playbtn->setIcon(pauseIcon);
    }
}

//切换静音模式
void Widget::on_volumebtn_clicked()
{
    QIcon volumHighIcon(":/image/images/volumeHigh.png");
    QIcon volumeCrossIcon(":/image/images/volumeCross.png");
    volumebtnbool = !volumebtnbool;
    if(this->volumebtnbool == true)
    {
        //设置有声模式
        ui->volumebtn->setIcon(volumHighIcon);
    }
    else
    {
        //设置无声模式
        ui->volumebtn->setIcon(volumeCrossIcon);
    }
}

//最大化与还原窗口
void Widget::on_maximizebtn_clicked()
{
    QIcon maximizeIcon(":/image/images/maximize.png");
    QIcon restoreIcon(":/image/images/restore.png");
    maximizebtnbool = !maximizebtnbool;
    if(this->maximizebtnbool == true)
    {
        //布尔值为真，说明当前窗口小于满屏或非满屏
        ui->maximizebtn->setIcon(maximizeIcon);
    }
    else
    {
        //布尔值为假，说明当前满屏，要显示还原窗口的图标
        ui->maximizebtn->setIcon(restoreIcon);
    }
}

//进入全屏与退出全屏
void Widget::on_fullscreenbtn_clicked()
{
    QIcon fullscteenIcon(":/image/images/fullscreen.png");
    QIcon fullScreenexitIcon(":/image/images/minimization.png");
    fullscreenbtnbool = !fullscreenbtnbool;
    if(this->fullscreenbtnbool == true)
    {
        //布尔值为真，说明当前不是全屏，要...
        ui->fullscreenbtn->setIcon(fullscteenIcon);
    }
    else
    {
        //布尔值为假，当前全屏，下一次操作是退出全屏
        ui->fullscreenbtn->setIcon(fullScreenexitIcon);
    }
}

